package com.msl.debezium.request;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.msl.debezium.desensitized.Sensitive;
import com.msl.debezium.desensitized.SensitiveTypeEnum;
import com.msl.debezium.validate.Phone;
import com.msl.debezium.validate.PhoneType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
public class QueryUserListReq implements Serializable {

    private final static long serialVersionUID= 3313335850842059002L;

    /**
     * Json请求时required、example仅用来显示入参信息，无校验效果
     * dataType="QueryUserListReq"
     */
    @ApiModelProperty(notes = "用户ID", required = true, example = "185")
    private Long id;

    @ApiModelProperty(notes = "用户名", example = "张一敏")
    private String username;

    @Phone(PhoneType.MOBILE)
    @ApiModelProperty(notes = "手机号", example = "13122021145")
    private String mobilePhone;

    /**
     * @DateTimeFormat(pattern = "yyyy-MM-dd"):格式化前端传来的非json中的日期
     * @JsonFormat(pattern = "yyyy-MM-dd"):
     * 用于请求体为json格式的请求
     * 将包含此注解的对象返回给前端时,也会沿用此注解的格式 (返回类型为json格式时)
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @JsonProperty("updated_at")
    @ApiModelProperty(notes = "修改时间", example = "2020-1-1")
    private Date updatedAt;
}
